import random

# 1.
class RanInt:
    """random int"""
    count = 10
    start = 0
    stop = 100
    def __init__(self,count=count,start=start,stop=stop):
        self.count = count
        self.start = start
        self.stop = stop

    def get_int(self):
        return random.choices(list(range(self.start,self.stop)),k=self.count)

n1 = RanInt(10)
print(n1.get_int())

print('#' * 40)


# 2. 列表改成生成器

class RanInt2:
    """random int"""
    count = 10
    start = 0
    stop = 100
    def __init__(self,count=count,start=start,stop=stop):
        self.count = count
        self.start = start
        self.stop = stop

    def __get_int(self):
        while True:
            yield random.randint(self.start,self.stop)

    def get_int(self):
        return [next(self.__get_int()) for _ in range(self.count)]

n2 = RanInt2(10)
print(n2.get_int())

print('#' * 40)

class Point:
    def __init__(self,x,y):
        self.x = x
        self.y = y

    def print_point(self):
        print('Point:({},{})'.format(self.x,self.y))
    # def __repr__(self):
    #     return 'Point:({},{})'.format(self.x,self.y)

n3 = RanInt2(20)
num = n3.get_int()
print(num)
nums = ((num[i],num[i+1]) for i in range(0,len(num),2))
for k in nums:
    point = Point(*k)
    point.print_point()

# print(*[Point(*v ) for v in nums],sep='\n')


